<?php

/**
 * @author @author Samrat Khan & Sadik Sarfaraz - Apr 8, 2013
 */
    require('top.inc.php');
?>
<?php
if(isset($_SESSION['user']) && $_SESSION['user']['utype'] == 1 || $_SESSION['user']['utype'] == 2 || $_SESSION['user']['utype'] == 3 || $_SESSION['user']['utype'] == 4) {
    $sess_cusID = $_SESSION['user']['cus_id'];
    
    echo "<div class='container'>";
        echo "<blockquote>";
            echo "<p>". getCustomer($sess_cusID, $db) ."</p>";
            echo "<small>please work with good spirit</small>";
            
            function getCustomerInfo($id, $db){
                $query = "SELECT * FROM customerinfo WHERE cus_id={$id} LIMIT 1";

                try {
                    $stmt = $db->prepare($query);
                    $stmt->execute();
                } catch (PDOException $ex) {
                    die("Failed to run query: " . $ex->getMessage());
                }
                $row1 = $stmt->fetchAll();
                $Info.="<address>";
                    $Info.="For any inquiry, ask following person.";
                    $Info.="<h4>".$row1[0]['keycontact_person']."</h4>";
                    $Info.="<h6>".$row1[0]['cellnumber']."</h6>";
                    $Info.=nl2br($row1[0]['cusaddress']);
                $Info.="</address>";
                
                return $Info;
            }
            echo getCustomerInfo($sess_cusID, $db);
            echo date('Y-m-d h:m:s');
        echo "</blockquote>";
        echo "<br/>";
        echo "<h1 style='color: #FFF;' class='btn btn-primary' type='button'>CSV Reports</h1> ";
        echo "<br/>";
        echo "<br/>";
        echo "<div class='bs-example'>";
            echo "<a class='btn btn-default' style='color: #000;' href=\"stockinhandcsv.php\" tabindex=\"-1\" role=\"menuitem\">Stock In Hand Report</a> ";
            echo "<a class='btn btn-info' style='color: #FFF;' href=\"stockincsv.php\" tabindex=\"-1\" role=\"menuitem\">Stock In Report</a> ";
            echo "<a class='btn btn-default' style='color: #000;' href=\"stockoutcsv.php\" tabindex=\"-1\" role=\"menuitem\">Stock Out Report</a> ";
            echo "<a class='btn btn-info' style='color: #FFF;' href=\"faultyreturncsv.php\" tabindex=\"-1\" role=\"menuitem\">Faulty Return Report</a> ";
            echo "<a class='btn btn-default' style='color: #000;' href=\"faultyexportcsv.php\" tabindex=\"-1\" role=\"menuitem\">Faulty Export Report</a> ";
            echo "<a class='btn btn-info' style='color: #FFF;' href=\"pickupcsv.php\" tabindex=\"-1\" role=\"menuitem\">Pickup Report</a> ";
            echo "<a class='btn btn-default' style='color: #000;' href=\"mtrcsv.php\" tabindex=\"-1\" role=\"menuitem\">MTR Report</a> ";
            echo "<a class='btn btn-info' style='color: #FFF;' href=\"rnoticsv.php\" tabindex=\"-1\" role=\"menuitem\">Return Notification Report</a> ";
        echo "</div>";
        echo "</div>";
} else {
    header("Location: login.php");
}
?>
<?php
    include ('bottom.inc.php');
?>